package cn.edu.ctbu.datajpa1.service;

import cn.edu.ctbu.datajpa1.domain.Student;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {

    /*
    * 读取所有学生数据
    * */
    List<Student> findAll();

    /*
     * 只支持分页的查询
     * */
    Page<Student> findAll(Pageable pageable);


    /*
     * 分页,带过滤的查询
     * @param pageable
     * */
    public Page<Student> findAll(Example<Student> student,Pageable pageable);



    /**
    按id进行查询
    *@param id 主键，整数
    *@return
     */
    Student findById(Integer id);

    /**
     * 按姓名查找
     * @param name
     * @return
     */
    List<Student> findByName(String name);

    /**
     * 按姓名和密码查找
     * @param name
     * @param password
     * @return
     */
    List<Student> findByNameAndPassword(String name,String password);

    void insert(Student student);

    Student update(Student student);

    void delete(Integer id);

    void delete(Student student);

    Student getById(Integer id);

    Student add(Student student);
}
